<?php
    echo $this->jQuery()->enable();
           //->addJavascriptFile('../../../../app/js/proprios/admin_submenu.js');
?>
<script type="text/javascript">
jQuery(document).ready(function(){

    // Monta combo de Controllers
    jQuery("#module").change(function(){
        var url = "/admin/controllers/montacombo/";
        $.ajax({
            type: "POST",
            url: '<?= $this->url(array('action' => 'montacombocontroller')); ?>',
            data:"module="+jQuery(this).val(),
            dataType: "json",
            success:function(data){
                jQuery("#controller").removeAttr('disabled');
                jQuery("#controller").empty();
                jQuery("#controller").append('<option value="">Selecione...</option>');
                for(var j=0;j<data.nome.length;j++){
                    jQuery("#controller").append('<option value='+data.id[j]+'>'+data.nome[j]+'</option>'); 
                }
            }
        })
    });

    // Montar combo de actions
    jQuery("#controller").change(function(){
        $.ajax({
            type: "POST",
            url: '<?= $this->url(array('action' => 'montacomboactions')); ?>',
            data:"controller="+jQuery(this).val(),
            dataType: "json",
            success:function(data){
                jQuery("#action").removeAttr('disabled');
                jQuery("#action").empty();
                jQuery("#action").append('<option value="">Selecione...</option>');
                for(var j=0;j<data.nome.length;j++){
                    jQuery("#action").append('<option value='+data.id[j]+'>'+data.nome[j]+'</option>');
                }
            }
        })
    });
})
</script>
<h1>Cadastro</h1>
<?php
    echo $this->form;